package edu.sctu.practice.class02.zhaozhongjun.assign3.a1;

/**
 * Created by zhao on 2015/11/5.
 */
public class Main {
    public static void main(String[] args) {

        GeometricObject geoObject1 = new Circle(10);
        GeometricObject geoObject2 = new Rectangle(10, 6);

        System.out.println("这两个图形的面积相等吗？ " + equalArea(geoObject1, geoObject2));

        displayGeometricObject(geoObject1);
        displayGeometricObject(geoObject2);
    }

    static boolean equalArea(GeometricObject object1, GeometricObject object2) {

        return object1.findArea() == object2.findArea();
    }

    static void displayGeometricObject(GeometricObject object) {

        System.out.println();
        System.out.println(object.toString());

        System.out.println("面积是 " + object.findArea());
        System.out.println("周长是 " + object.findPerimeter());
    }
}


